#region License, Terms and Conditions
//
// Prawks - Copyright (c) 2007 Atif Aziz. All rights reserved.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License as published by the Free
// Software Foundation; either version 2.1 of the License, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
// details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this library; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
//
#endregion

namespace Prawks.SqlMethods
{
    using System;
    using Prawks.DbMethods;

    using MethodInfo = System.Reflection.MethodInfo;
    using IMethodImpl = CodeProvisioning.IMethodImpl;

    /// <summary>
    /// Apply this attribute to an abstract method that will receive the output
    /// parameters of a SQL Server stored procedure or a Transact-SQL query.
    /// </summary>

    [ AttributeUsage(AttributeTargets.Method) ]
    public sealed class SqlOutMethodAttribute : DbOutMethodImplAttribute
    {
        /// <summary>
        /// Creates an instance of <see cref="SqlOutMethod"/> that is bound to
        /// the given method and which can be used to implement the method.
        /// </summary>
        /// <param name="method">
        /// The method to which the <see cref="SqlOutMethod"/> instance will be bound.
        /// </param>
        /// <returns>
        /// Returns an instance of <see cref="SqlOutMethod"/>.
        /// </returns>

        public override IMethodImpl CreateImpl(MethodInfo method)
        {
            if (method == null)
                throw new ArgumentNullException("method");

            return new SqlOutMethod(method);
        }
    }
}
